<include file="public/layout" />
<style>
    td{height:40px;line-height:40px; padding-left:20px;}
    .span_1{
        float:left;
        margin-left:0px;
        height:130px;
        line-height:130px;
    }
    .span_1 ul{list-style:none;padding:0px;}
    .span_1 ul li{
        border:1px solid #CCC;
        height:40px;
        padding:0px 10px;
        margin-left:-1px;
        margin-top:-1px;
        line-height:40px;
    }
</style>
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>门诊 - 门诊信息</h3>
                <h5>网站系统门诊会员信息</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="user_form" method="post">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>会员昵称</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt valid" name="nickname" value="{$user.nickname}"  type="text">
                    <p class="notic">会员昵称不可修改。</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>会员资产</label>
                </dt>
                <dd class="opt">
                	<strong class="red">{$user.user_money}</strong>&nbsp;余额 &nbsp;&nbsp;
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>会员等级</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt valid"  value="{$user.distribut_name}" readonly="" type="text">
                </dd>
            </dl>
            <!--<dl class="row">-->
                <!--<dt class="tit">-->
                    <!--<label for="email"><em>*</em>电子邮箱</label>-->
                <!--</dt>-->
                <!--<dd class="opt">-->
                    <!--<input id="email"  name="email" value="{$user.email}" class="input-txt" type="text">-->
                    <!--<span class="err"></span>-->
                    <!--<p class="notic">请输入常用的邮箱，将用来找回密码、接受通知等。</p>-->
                <!--</dd>-->
            <!--</dl>-->
            <dl class="row">
                <dt class="tit">
                    <label for="mobile"><em>*</em>手机号码</label>
                </dt>
                <dd class="opt">
                    <input id="mobile"  name="mobile" value="{$user.mobile}" class="input-txt" type="text">
                    <span class="err"></span>
                    <p class="notic">请输入常用的手机号码，将用来找回密码、接受通知等。</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="password">新密码</label>
                </dt>
                <dd class="opt">
                    <input id="password" name="password" class="input-txt" type="password">
                    <span class="err"></span>
                    <p class="notic">留空表示不修改密码</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="password2">确认密码</label>
                </dt>
                <dd class="opt">
                    <input id="password2" name="password2" class="input-txt" type="password">
                    <span class="err"></span>
                    <p class="notic">留空表示不修改密码</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="password2">省市区</label>
                </dt>
                <dd class="opt">
                <select onchange="get_city(this)" id="province" name="province">
                    <option  value="0">选择省份</option>
                    <volist name="province" id="vo">
                        <option value="{$vo.id}" <if condition="$user.province eq $vo[id]">selected</if>>{$vo.name}</option>
                    </volist>
                </select>
                <select onchange="get_area(this);" id="city" name="city">
                    <option value="0">选择城市</option>
                    <volist name="city" id="vo">
                        <option value="{$vo.id}" <if condition="$user.city eq $vo[id]">selected</if>>{$vo.name}</option>
                    </volist>
                </select>
                <select id="district" name="district">
                    <option value="0">选择区域</option>
                    <volist name="area" id="vo">
                        <option value="{$vo.id}" <if condition="$user.district eq $vo[id]">selected</if>>{$vo.name}</option>
                    </volist>
                </select>
                <input name="address" value="{$user.address}">
                <span class="help-inline" style="color:#F00; display:none;" id="err_address"></span>
                    </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label for="parent_id"><em>*</em>选择推荐合伙人</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="user_name" id="user_name" class="input-txt" placeholder="用户昵称搜索" />
                    <select name="parent_id" id="parent_id" class="class-select valid">
                        <option value="0">无推荐城市合伙人</option>
                        <volist name="all_member" id="vo">
                            <option value="{$vo.user_id}" <if condition="$user.parent_id eq $vo[user_id]">selected</if>>{$vo.nickname}</option>
                        </volist>
                    </select>
                    <a href="javascript:void(0);" onclick="search_user();" class="ncap-btn ncap-btn-green" ><i class="fa fa-search"></i>搜索</a>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>性别</label>
                </dt>
                <dd class="opt">
                    <input value="0" name="sex" id="member_sex0" type="radio" <if condition="$user['sex'] eq 0">checked</if>>
                    <label for="member_sex0">保密</label>
                    <input value="1" name="sex" id="member_sex1" type="radio" <if condition="$user['sex'] eq 1">checked</if>>
                    <label for="member_sex1">男</label>
                    <input value="2" name="sex" id="member_sex2" type="radio" <if condition="$user['sex'] eq 2">checked</if>>
                    <label for="member_sex2">女</label>
                    <span class="err"></span> </dd>
            </dl>

            <if condition = "session('user_id') eq 0 ">
            <div class="bot"><a href="JavaScript:void(0);" onclick="checkUserUpdate();" class="ncap-btn-big ncap-btn-green">确认提交</a></div>
            </if>
        </div>
    </form>
</div>
<script type="text/javascript">
    function checkUserUpdate(){
        // var email = $('input[name="email"]').val();
        var mobile = $('input[name="mobile"]').val();
        var password = $('input[name="password"]').val();
        var password2 = $('input[name="password2"]').val();

        var error ='';
        if(password != password2){
            error += "两次密码不一样\n";
        }
        // if(!checkEmail(email) && email != ''){
        //     error += "邮箱地址有误\n";
        // }
        if(!checkMobile(mobile) && mobile != ''){
            error += "手机号码填写有误\n";
        }
        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        $('#user_form').submit();
    }
    function search_user(){
        var user_name = $('#user_name').val();
        if($.trim(user_name) == '')
            return false;
        $.ajax({
            type : "POST",
            url:"/index.php?m=Admin&c=Distribut&a=search_user",//+tab,
            data :{search_key:$('#user_name').val(),state:2},// 你的formid
            dataType :'json',
            success: function(data){
                if(data.status == 1){
                    var html='';
                    for(var i=0 ; i<data.result.length ;i++){
                        html +="<option value='"+data.result[i].user_id+"' nickname='"+data.result[i].nickname+"'>【ID-"+data.result[i].user_id+'】'+data.result[i].nickname+"</option>"
                    }
                    $('#parent_id').html(html);
                }else{
                    layer.msg(data.msg, {icon: 2});
                }
            }
        });
    }
</script>
</body>
</html>